// components/selectDrop/index.ts
Component({

  /**
   * 组件的属性列表
   */
  properties: {
   selectName:{
     type:String,
     value:'',
     observer:function(val){ 

     }
   },
   selectList:{
     type:Array,
     value:[
    ],
    observer:function(val){
      let nameList = val.filter(item=>{
        return item.id == this.properties.selectName
      })
     if(nameList.length > 0){
      const name = nameList[0].name
      this.setData({
       selectLabel:name
      }) 
     }
      

    }
   }
  },

  /**
   * 组件的初始数据
   */
  data: {
    selectLabel:"",
    select: false,
  },

  /**
   * 组件的方法列表
   */
  methods: {
    bindShowMsg() {
      this.setData({
          select:!this.data.select
      })
 },
 mySelect(e:any) {
     let {name,id}  = e.currentTarget.dataset
     this.setData({
         selectLabel: name,
         select: false
     })
     this.triggerEvent("dropSelect",id)
 }
  }
})